package ynu.edu.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import ynu.edu.entity.OrderEntity;

import java.util.List;

/**
 * 订单存储库
 */
@Repository
public interface OrderRepository extends JpaRepository<OrderEntity, Integer> {
    
    /**
     * 根据用户ID查询订单列表
     */
    List<OrderEntity> findByUserIdOrderByOrderDateDesc(String userId);
    
    /**
     * 根据用户ID和订单状态查询订单列表
     */
    List<OrderEntity> findByUserIdAndOrderStateOrderByOrderDateDesc(String userId, Integer orderState);
    
    /**
     * 根据商家ID查询订单列表
     */
    List<OrderEntity> findByBusinessIdOrderByOrderDateDesc(Integer businessId);
    
    /**
     * 根据商家ID和订单状态查询订单列表
     */
    List<OrderEntity> findByBusinessIdAndOrderStateOrderByOrderDateDesc(Integer businessId, Integer orderState);
} 